package com.ruoyi.xiaoshou.service.impl;

import com.ruoyi.xiaoshou.domain.SaleOrderDetail;
import com.ruoyi.xiaoshou.mapper.SaleOrderDetailMapper;
import com.ruoyi.xiaoshou.service.SaleOrderDetailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;
@Service
public class SaleOrderDetailServiceImpl implements SaleOrderDetailService {

    @Autowired
    private SaleOrderDetailMapper saleOrderDetailMapper;


    private Logger logger = LoggerFactory.getLogger(SaleOrderDetailServiceImpl.class);



    @Override
    public List<SaleOrderDetail> getList(int orderId) {
        logger.info("SaleOrderDetailServiceImpl  getList start......orderId:"+orderId);
        List<SaleOrderDetail> list = saleOrderDetailMapper.getList(orderId);
        logger.info("SaleOrderDetailServiceImpl  getList end......list:{}"+list);
        return list;
    }

    @Override
    public List<SaleOrderDetail> getSaleOrderDetailListByOrderId(int orderId) {
        logger.info("SaleOrderDetailServiceImpl  getSaleOrderDetailListByOrderId start......orderId:"+orderId);
        List<SaleOrderDetail> list = saleOrderDetailMapper.getSaleOrderDetailListByOrderId(orderId);
        logger.info("SaleOrderDetailServiceImpl  getSaleOrderDetailListByOrderId end......list:{}",list);
        return list;
    }

    @Override
    public int updDetailStock(SaleOrderDetail saleOrderDetail) {
        logger.info("SaleOrderDetailServiceImpl updDetailStock start......saleOrderDetail:{}",saleOrderDetail);
        return saleOrderDetailMapper.updDetailStock(saleOrderDetail);
    }

    @Override
    public SaleOrderDetail getSaleOrderDetailByProIdAndOrderId(SaleOrderDetail saleOrderDetail) {
        logger.info("SaleOrderDetailServiceImpl getSaleOrderDetailByProIdAndOrderId start.....saleOrderDetail:{}",saleOrderDetail);
        SaleOrderDetail saleOrderDetail1 = saleOrderDetailMapper.getSaleOrderDetailByProIdAndOrderId(saleOrderDetail);
        logger.debug("SaleOrderDetailServiceImpl getSaleOrderDetailByProIdAndOrderId   end....saleOrderDetail:{}",saleOrderDetail1);
        return saleOrderDetail1;
    }
}
